1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%" height="17">
4         Danh m&#
7909;c hình : <b> <a href="./?act=album_category_m"><font color="#FFFFFF">Nh&#7853;p
5         M&#
7899;i</font></a><font color="#FFFFFF"> |</font></b></td>
6       </tr>
7     </table>
8 <?
9     
switch ($_GET['action'])
10     {
11         
case 'del' :
12             $id = $_GET[
'id'];
13             $result = mysql_query(
"select album_images_categoriesid from album_images where album_images_categoriesid='".$id."'",$con);
14             
if (mysql_num_rows($result)<=0) {
15                 $sql =
"delete from album_categories where album_categories_id='".$id."'";
16                 @$result = mysql_query($sql,$con);
17                 
if ($result) echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
18                 
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</font></p>";
19             }
else {
20                 echo
"<p align=center class='err'>&#272;ang có s&#7843;n ph&#7849;m s&#7917; d&#7909;ng. nên b&#7841;n không th&#7875; xóa</p>";
21             }
22             
23             
break;
24     }
25 ?>
26
27 <?
28     
if (isset($_POST['ButDel'])) {
29         $cnt=
0;
30         
foreach ($_POST['chk'] as $id)
31         {
32             @$result = mysql_query(
"delete from album_categories where album_categories_id='".$id."'",$con);
33             
if ($result) $cnt++;
34         }
35         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
36     }
37 ?>
38 <?
39     $page = $_GET[
"page"];
40     $MAXPAGE=
10;
41     $p=
0;
42     
if ($page!='') $p=$page;
43 ?>
44 <form method=
"POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
45 <input type=hidden name=
"page" value="<? echo $page; ?>">
46 <?
47 function taotrang($sql,$link,$nitem,$itemcurrent)
48 {
global $con;
49     $ret=
"";
50     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
51     $
value = mysql_fetch_array($result);
52     $plus = (($
value['cnt'] % $nitem)>0);
53     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
54     {
55         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
56         
else $ret .= ($i+1)." ";
57     }
58     
return $ret;
59 }
60     $pageindex=taotrang(
"select count(*) from album_categories","./?act=album_category"."&page=",$MAXPAGE,$page);
61 ?>
62
63 <?
if ($_REQUEST['code']==1) echo "<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t thành công</p>"; ?>
64
65 <table cellspacing=
"0" cellpadding="0">
66 <tr>
67 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
68 </tr>
69 </table>
70
71 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
72   <tr>
73     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
74     <td nowrap
class="title">&nbsp;</td>
75     <td nowrap
class="title">&nbsp;</td>
76     <td align=
"center" nowrap class="title"><b>Mã</b></td>
77     <td align=
"center" nowrap class="title"><b>Tên</b></td>
78     <td align=
"center" nowrap class="title"><b>Thu&#7897;c danh m&#7909;c</b></td>
79     <td align=
"center" nowrap class="title"><b>Không hi&#7875;n th&#7883;</b></td>
80     <td align=
"center" nowrap class="title"><b>Ngày</b></td>
81   </tr>
82   
83   <?
84                 $sql=
"select *,DATE_FORMAT(date_added,'%d/%m/%Y %h:%m') as dateformat from album_categories order by album_categories_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
85                 $result=mysql_query($sql,$con);
86                 $i=
0;
87                 
while(($row=mysql_fetch_array($result)))
88                 {
89                     $i++;
90                     
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
91                     $parentname=
"";
92                     
if ($row['album_categories_parentid']>0)
93                     {
94                         $sqlcat=
"select * from album_categories where album_categories_id='".$row['album_categories_parentid']."' limit 1";
95                         $rowsub=mysql_fetch_array(mysql_query($sql,$con));
96                         $parentname=$rowsub[
'album_categories_name'];
97                     }
98                     
else
99                         $parentname=
"Th&#432; m&#7909;c g&#7889;c";
100   ?>
101   
102   <tr>
103     <td width=
"20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
104     <input type=
"checkbox" name="chk[]" value="<? echo $row['album_categories_id']; ?>"></td>
105     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
106     <a href=
"./?act=album_category_m&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['album_categories_id']; ?>">Edit</a></td>
107     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
108     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=album_category&page=<? echo $_REQUEST['page']; ?>&action=del&id=<? echo $row['album_categories_id']; ?>">Delete</a></td>
109     <td width=
"20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['album_categories_id']; ?>&nbsp;</td>
110     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['album_categories_name']; ?>&nbsp;</td>
111     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $parentname; ?>&nbsp;</td>
112     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_categories_status']; ?>&nbsp;</td>
113     <td width=
"100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['dateformat']; ?>&nbsp;</td>
114   </tr>
115   <?
116                 }
117   ?>
118 </table>
119 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button" style="padding: 0">
120 <input type=
"hidden" name="act" value="album_category">
121 </form>
122 <script language=
"JavaScript">
123 function chkallClick(o) {
124     
var form = document.frmList;
125     
for (var i = 0; i < form.elements.length; i++) {
126         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
127             form.elements[i].
checked = document.frmList.chkall.checked;
128         }
129     }
130 }
131 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.940 lượt xem

Gõ tìm kiếm nhanh...